package com.detection.dahua.persistence;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class OpenDoorTypeDict {


    private static final Map<String, String> map = new LinkedHashMap<>();

    private static void init() {
        map.clear();
//        map.put("0", "cd65e28c-2fa8-49a2-8daa-0e3af9030dbd");//大门
//        map.put("1", "1a593c85-4a8e-499c-b198-74ac978ced86");//通讯机房楼
//        map.put("2", "24ce38c1-10ec-4b38-bcad-ff5b52748f99");//宿舍楼
        map.put("42","合法密码开门");
        map.put("43","合法密码关门");
        map.put("45","合法指纹开门");
        map.put("46","合法指纹关门");
        map.put("48","远程开门");
        map.put("49","按钮开门");
        map.put("50","钥匙开门");
        map.put("51","合法刷卡开门");
        map.put("52","非法刷卡开门");
        map.put("53","门磁");
        map.put("54","异常开门");
        map.put("55","异常关门");
        map.put("56","正常开门");
        map.put("57","正常关门");
        map.put("59","报警门禁对讲请求报警");
        map.put("61","人像刷门");
        map.put("62","人像非法刷门");
        map.put("1436","人证合法开门");
        map.put("1437","人证非法开门");
        map.put("1438","人证和身份证非法开门");
        map.put("1439","人证和身份证合法开门");
        map.put("1448","RFID感应报警");
        map.put("1449","RFID非法感应报警");
        map.put("1450","RFID外部报警");
        map.put("196893","人脸认证通过");
        map.put("197151","人脸认证失败");
        map.put("197160","人脸认证失败");
        map.put("197127","指纹认证通过");
        map.put("197128","指纹认证失败");
        map.put("197140","人脸认证通过");
        map.put("197140","指纹不存在");
        map.put("198914","合法卡比对通过");
        map.put("199710","设备离线");
    }

    public static String get(String type){
        loadData();
        return map.get(type);
    }

    private static void loadData() {
        if (map.isEmpty()) {
            init();
        }
    }

    public static List<String> getTypeNames(){
        loadData();
        return new ArrayList<>(map.values());
    }

    public static List<String> getKeys(){
        loadData();
        return new ArrayList<>(map.keySet());
    }

}
